﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AlgoImpl
{
    public class Nieghbour
    {
        private readonly string m_Id;
        private int m_Weight;
        private int m_MaxWeight;

        public Nieghbour(string id, int maxWeight)
        {
            m_Id = id;
            m_MaxWeight = maxWeight;
            m_Weight = 1;   
        }

        public int Weight
        {
            get { return m_Weight; }
            set { m_Weight = value; }
        }

        public int MaxWeight
        {
            get { return m_MaxWeight; }
        }

        public string Id
        {
            get
            {
                return m_Id;
            }
        }

        public override string ToString()
        {
            string toReturn = string.Empty;
            toReturn = string.Format("Id={0} weight={1} maxWeight={2}, ", m_Id, m_Weight, m_MaxWeight);
            return toReturn;
        }

        public void DecreaseWeight()
        {
            if (m_Weight > 0)
            {
                m_Weight--;
            }
            else
            {
                // throw exception ...
            }
        }

        public void IncreaseWeight()
        {
            if (m_Weight < m_MaxWeight)
            {
                m_Weight++;
            }
            else
            {
                // throw exception ...
            }
        }
    }

}
